修复(OMP):终端原生 Ask 与 CodeIsland 并行回答#264
Open
haixing23 wants to merge 5 commits into
Open
Conversation
Register a shadow 'ask' tool that concurrently starts OMP's built-in AskTool (terminal rendering, navigation, timeout, multi-question wizard) and a blocking CodeIsland AskUserQuestion. Whichever side returns a real answer first wins; the loser is cancelled immediately. This replaces the previous flow where the extension handler blocked inside tool_call until CodeIsland answered, delaying the terminal dialog (wxtsky#244 -> wxtsky#256). Users can now answer from either the terminal or the CodeIsland/iPhone/Watch UI without waiting for a handler timeout. Key changes: - Shadow ask reuses pi.pi.AskTool for its executor and LLM-facing label/description, preserving OMP's behavioral guidance. - Bridge request carries _codeisland_native_ask_racing so AppState can scope Smart Suppress: only OMP requests with this marker may stay collapsed when the terminal is frontmost. Pi and legacy OMP keep the forced-expand fallback from wxtsky#256. - Genuine native AskTool failure cancels the island bridge and propagates immediately instead of waiting for a 24h island timeout. - Structured answer details (selectedOptions, customInput) are passed back via _codeislandAnswerDetails, scoped to pi source + toolUseId. - QuestionBar preserves selectedOptions/customInput for all sources; non-OMP paths still consume the original answer string unchanged. - multiSelect=true with empty/no options now shows a usable Submit button for free-text input (shared fix). - HookEvent parses _pi_tool_call_id for OMP tool call correlation. - OMP extension version bumped v2 -> v4. - Native AskTool reuse probe, 20 AppStateQuestionFlowTests, and 9 HookEventToolUseIdTests all pass.
P1: When Smart Suppress kept the CodeIsland ask card collapsed, a native TUI cancel (Esc) returned null but the gate still waited for the hidden island bridge (24h timeout). Now any side finishing — answer, skip, cancel, or failure — immediately cancels the other and settles. No more per-side done/failed tracking; settle() is idempotent. Smart Suppress: showNextPending() left an inherited .questionCard surface expanded when the promoted OMP ask should be collapsed. Now folds it to .collapsed (but never touches .sessionList). Also: reuse native AskTool label/description instead of a one-liner; remove dead tuiFailed/tuiError code paths; add regression test for non-OMP -> OMP mixed-source queue promotion.
haixing23
marked this pull request as draft
July 15, 2026 10:43
nguyenvanduocit
pushed a commit
to nguyenvanduocit/CodeIsland
that referenced
this pull request
Jul 16, 2026
Upstream quiet since v1.0.30 (Jul 10). One new watch item: - T-076: panel intermittently shifts from notch to upper-left corner on macOS 27.0 beta (issue wxtsky#263, M5 Pro, no upstream fix yet) Skip: PR wxtsky#264 (OMP), PR wxtsky#262 (Cursor Tasks), issue wxtsky#265 (Cursor) — all non-Claude CLIs or Cursor-specific. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P5RZPP2LLwKBjbXuqKxDjf
Owner
|
方向确认:认可 racing 方案,「终端和 CodeIsland 同时可答、先答者生效」正是这里想要的终态,比 #256 的强制展开更贴合 Smart Suppress 的语义,不必等 OMP 官方扩展接口。 标 ready 前请确保三点:
另外 |
# Conflicts: # Sources/CodeIslandCore/Models.swift
haixing23
marked this pull request as ready for review
July 23, 2026 07:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联
ask工具时 CodeIsland 不弹提问 #244 的后续修复AskUserQuestion强制展开策略问题背景
#244 已支持从 CodeIsland 回填 OMP
ask的答案,但旧实现会在tool_callhandler 中阻塞等待 CodeIsland。等待期间 OMP 原生终端选择框尚未打开,因此用户只能在 CodeIsland 回答;若问题卡未展开,就会出现双方都无法操作的状态。本 PR 改为真正的双入口竞速:终端原生 Ask 与 CodeIsland 同时可答,先完成的一端生效并取消另一端。
修改内容
1. 原生 Ask 与 CodeIsland 并行竞速
ask,同时调用 OMP 内置AskTool和 CodeIsland bridge;2. 严格校验并结构化回填答案
selectedOptions、customInput与多选结果;header,缺失时回退到必填id。3. Smart Suppress 与旧入口兼容
_codeisland_native_ask_racing: true标记的新 OMP 请求允许 Smart Suppress 折叠;4. 自动升级 extension
OMP extension 升级到
v6。CodeIsland 会把已安装的v2~v5自动覆盖为当前版本;测试验证旧文件确实被重写。5. 共享 UI 与事件关联修复
multiSelect=true且无预设选项时显示可用的纯文本提交按钮;HookEvent.toolUseId增加_pi_tool_call_id,同时保留上游 ZCode 的toolCallId。降级行为
验证
94/94通过(21 + 64 + 9)7/7通过,18 个断言tsc --noEmit类型检查:通过FINAL_TUI_V2=Beta;FINAL_ISLAND_V2=Beta;final_island_v2。